/*
 * @Author: your name
 * @Date: 2021-03-14 11:42:09
 * @LastEditTime: 2021-03-15 00:54:28
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /gitee/cpp/test/test.cpp
 */

#include <iostream>
#include <stdlib.h>
using namespace std;

class Dog {
public:
    Dog(string sName):m_sName(sName)
    {
    }
    virtual ~Dog()
    {
    }
//protected:
friend class Dog_Td;
private:
    void showDogname()
    {
        cout << m_sName << endl;
    }

private:
    string m_sName;
};

class Dog_Td :public Dog{
public:
    Dog_Td(string sName, int n):num(n),Dog(sName)
    {
    }
    virtual ~Dog_Td()
    {
    }

    void tttt()
    { 
        showDogname();
    }
    
    // Dog_Td operator+(const Dog_Td& d)
    // {
    //     this->num += d.num;
    //     return *this;
    // }

    void shownum()
    {
        cout << num << endl;
    }

private:
    string m_sName;
public:
    int num;
};

int xxx = 11;

void show1(int s, void *arg)
{
    cout << "111" << endl;
}

void show2(int s, void *arg)
{
    cout << "222" << endl;
}

void show3(int s, void *arg)
{
    cout << "333" << endl;
}

void show4(int s, void *arg)
{
    cout << "444" << endl;
}

int operator+(const Dog_Td& d,const Dog_Td& d2)
{
    return d.num + d2.num;
}

struct ss {
    char a;
    int x[0];
    short mm;
};

int numss(int x)
{
    cout << x << endl;
    return x;
}
int main()
{
    on_exit(show1, NULL);
    on_exit(show2, NULL);
    on_exit(show3, NULL);
    on_exit(show4, NULL);

    int xxx = 12;

    cout << ::xxx << " " << xxx << endl;
    Dog_Td d1("泰迪1",1);
    Dog_Td d2("泰迪2",2);
    //d1 = d1 + d2;
    d1.tttt();
    d2.tttt();
    d1.shownum();
    d2.shownum();
    cout << (d1 + d2) << endl;
    char x = 0;
    x = 0x111;
    cout << (int)x << endl;

    int **m[3][4];
    cout << sizeof(ss) << endl;
    int i = 10;
    cout << numss(11) * numss(10)<< endl;
    char *p1 = "aaa";
    char *p2 = "aaa";
    char p3[] = "aaa";
    char p4[] = "aaa";

    char * xx = (char*)((void*)p3 + 1);
    *xx = 'b';

    cout << p3<< " " << &p1<< " " <<&p2<<  " " << (void*)(p2) <<" " << static_cast<const void *>(p1) << endl;
}